package com.example.newproject_overseas.Screen

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.scale
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.example.newproject_overseas.R
import com.example.newproject_overseas.components.TopApp

@Composable
fun PersonalInformation(navController: NavHostController) {

    Box(  modifier = Modifier
        .fillMaxSize()
        .background(color = Color(0XFFEFF0F3))){

        Column(
            modifier = Modifier
                .fillMaxSize()
                .background(color = Color(0XFFEFF0F3)),

            ) {

            TopApp(title = "PersonalInformation", navController = navController)

            LazyColumn(
                modifier = Modifier

                    .padding(horizontal = 12.dp)
            ) {
                item {
                    Box(
                        modifier = Modifier
                            .padding(top = 20.dp)
                            .shadow(7.5.dp, shape = RoundedCornerShape(7.5.dp), clip = true)
                            .fillMaxWidth()
                            .height(50.dp)
                            .clip(RoundedCornerShape(7.5.dp)) // 设置圆角为36dp
                            .background(Color.White)  ) {
                        Row(modifier = Modifier
                            .padding(top = 15.dp)
                            .padding(horizontal = 20.dp)) {
                            Text(text = "Education")
                            Spacer(modifier = Modifier.weight(1f))
                            Image(
                                painter = painterResource(id = R.drawable.go_in),
                                contentDescription = null,
                                modifier = Modifier
                                    .width(20.dp)
                                    .height(20.dp)
                                    .scale(0.9f)
                            )
                        }
                    }
                }

                item {
                    Box(
                        modifier = Modifier
                            .padding(top = 20.dp)
                            .shadow(7.5.dp, shape = RoundedCornerShape(7.5.dp), clip = true)
                            .fillMaxWidth()
                            .height(50.dp)
                            .clip(RoundedCornerShape(7.5.dp)) // 设置圆角为36dp
                            .background(Color.White) ) {
                        Row(modifier = Modifier
                            .padding(top = 15.dp)
                            .padding(horizontal = 20.dp)) {
                            Text(text = "Gender")
                            Spacer(modifier = Modifier.weight(1f))
                            Image(
                                painter = painterResource(id = R.drawable.go_in),
                                contentDescription = null,
                                modifier = Modifier
                                    .width(20.dp)
                                    .height(20.dp)
                                    .scale(0.9f)
                            )
                        }
                    }
                }

                item {
                    Box(
                        modifier = Modifier
                            .padding(top = 20.dp)
                            .shadow(7.5.dp, shape = RoundedCornerShape(7.5.dp), clip = true)
                            .fillMaxWidth()
                            .height(50.dp)
                            .clip(RoundedCornerShape(7.5.dp)) // 设置圆角为36dp
                            .background(Color.White) ) {
                        Row(modifier = Modifier
                            .padding(top = 15.dp)
                            .padding(horizontal = 20.dp)) {
                            Text(text = "Gender")
                            Spacer(modifier = Modifier.weight(1f))
                            Image(
                                painter = painterResource(id = R.drawable.go_in),
                                contentDescription = null,
                                modifier = Modifier
                                    .width(20.dp)
                                    .height(20.dp)
                                    .scale(0.9f)
                            )
                        }
                    }
                }

                item {
                    Box(
                        modifier = Modifier
                            .padding(top = 20.dp)
                            .shadow(7.5.dp, shape = RoundedCornerShape(7.5.dp), clip = true)
                            .fillMaxWidth()
                            .height(50.dp)
                            .clip(RoundedCornerShape(7.5.dp)) // 设置圆角为36dp
                            .background(Color.White)) {
                        Row(modifier = Modifier
                            .padding(top = 15.dp)
                            .padding(horizontal = 20.dp)) {
                            Text(text = "Marital Status")
                            Spacer(modifier = Modifier.weight(1f))
                            Image(
                                painter = painterResource(id = R.drawable.go_in),
                                contentDescription = null,
                                modifier = Modifier
                                    .width(20.dp)
                                    .height(20.dp)
                                    .scale(0.9f)
                            )
                        }
                    }
                }

                item {
                    Box(
                        modifier = Modifier
                            .padding(top = 20.dp)
                            .shadow(7.5.dp, shape = RoundedCornerShape(7.5.dp), clip = true)
                            .fillMaxWidth()
                            .height(50.dp)
                            .clip(RoundedCornerShape(7.5.dp)) // 设置圆角为36dp
                            .background(Color.White) ) {
                        Row(modifier = Modifier
                            .padding(top = 15.dp)
                            .padding(horizontal = 20.dp)) {
                            Text(text = "Children count")
                            Spacer(modifier = Modifier.weight(1f))
                            Image(
                                painter = painterResource(id = R.drawable.go_in),
                                contentDescription = null,
                                modifier = Modifier
                                    .width(20.dp)
                                    .height(20.dp)
                                    .scale(0.9f)
                            )
                        }
                    }
                }

                item {
                    Box(
                        modifier = Modifier
                            .padding(top = 20.dp)
                            .shadow(7.5.dp, shape = RoundedCornerShape(7.5.dp), clip = true)
                            .fillMaxWidth()
                            .height(50.dp)
                            .clip(RoundedCornerShape(7.5.dp)) // 设置圆角为36dp
                            .background(Color.White)) {
                        Row(modifier = Modifier
                            .padding(top = 15.dp)
                            .padding(horizontal = 20.dp)) {
                            Text(text = "Residence")
                            Spacer(modifier = Modifier.weight(1f))
                            Image(
                                painter = painterResource(id = R.drawable.go_in),
                                contentDescription = null,
                                modifier = Modifier
                                    .width(20.dp)
                                    .height(20.dp)
                                    .scale(0.9f)
                            )
                        }
                    }
                }

                item {
                    Box(
                        modifier = Modifier
                            .padding(top = 20.dp)
                            .shadow(7.5.dp, shape = RoundedCornerShape(7.5.dp), clip = true)
                            .fillMaxWidth()
                            .height(50.dp)
                            .clip(RoundedCornerShape(7.5.dp)) // 设置圆角为36dp
                            .background(Color.White) ) {
                        Row(modifier = Modifier
                            .padding(top = 15.dp)
                            .padding(horizontal = 20.dp)) {
                            Text(text = "Address")
                            Spacer(modifier = Modifier.weight(1f))
                            Image(
                                painter = painterResource(id = R.drawable.go_in),
                                contentDescription = null,
                                modifier = Modifier
                                    .width(20.dp)
                                    .height(20.dp)
                                    .scale(0.9f)
                            )
                        }
                    }
                }

                item {
                    Box(
                        modifier = Modifier

                            .padding(top = 20.dp)
                            .padding(bottom = 100.dp )
                            .shadow(7.5.dp, shape = RoundedCornerShape(7.5.dp), clip = true)
                            .fillMaxWidth()
                            .height(140.dp)
                            .clip(RoundedCornerShape(7.5.dp)) // 设置圆角为36dp
                            .background(Color.White) ){
                        Column(modifier = Modifier
                            .padding(10.dp)
                            .fillMaxWidth()
                            .height(130.dp)
                            .background(Color(0xFFF1F1F1))
                            .padding(vertical = 15.dp, horizontal = 15.dp)
                        ) {
                            Row() {
                                Text(text = "Postal code")
                                Spacer(modifier = Modifier.weight(1f))
                                Text(text = "Please enter Postal code")
                            }

                            Row(modifier = Modifier.padding(top = 15.dp)) {
                                Text(text = "Company pincode")
                                Spacer(modifier = Modifier.weight(1f))
                                Text(text = "Please enter Address")
                            }

                            Row(modifier = Modifier.padding(top = 15.dp)) {
                                Text(text = "Company pincode")
                                Spacer(modifier = Modifier.weight(1f))
                                Text(text = "Please enter Email")
                            }

                        }

                    }
                }

            }

        }

        //底部按钮
        Button(onClick = { /*TODO*/ }, modifier = Modifier
            .fillMaxWidth(1f)
            .height(44.dp)
            .align(Alignment.BottomCenter),
            colors = ButtonDefaults.buttonColors(Color(0xFFFFCC00)),
            shape = RoundedCornerShape(4.5.dp)) {
            androidx.compose.material.Text(
                modifier = Modifier,
                text = "Submit",
                color = Color(0xFFFFFFFF),
                fontSize = 20.sp
            )
        }
    }

}

@Preview
@Composable
fun PersonalInformationPreview() {
    val navController = rememberNavController() // 假设这里使用了导航控制器
    PersonalInformation(navController)
}

